package com.yanqu.road.entity.config.winery;


import com.yanqu.road.entity.FieldTypeAnnotation;
import org.bouncycastle.util.Strings;

import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_p_winery")
public class WineryConfig {
    @FieldTypeAnnotation(desc = "Id", select = true, update = true, orderASC = true)
    private int id;
    @FieldTypeAnnotation(desc = "建筑名称")
    private String name;
    @FieldTypeAnnotation(desc = "区域类型")
    private int type;
    @FieldTypeAnnotation(desc = "建筑升级消耗(技能升级表)")
    private int upgrade;
    @FieldTypeAnnotation(desc = "技能列表(建筑升级|升级效果)")
    private String skills;

    private List<Integer> skillList = new ArrayList<>();

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getUpgrade() {
        return upgrade;
    }

    public void setUpgrade(int upgrade) {
        this.upgrade = upgrade;
    }

    public String getSkills() {
        return skills;
    }

    public void setSkills(String skills) {
        this.skills = skills;
    }


    public void parse() {
        String[] split = Strings.split(this.skills, '|');
        for (String s : split) {
            int i = Integer.parseInt(s);
            this.skillList.add(i);
        }
    }

    public List<Integer> getSkillList() {
        return skillList;
    }

    public void setSkillList(List<Integer> skillList) {
        this.skillList = skillList;
    }
}
